package xu.zhi.qing.page.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import xu.zhi.qing.common.controller.BaseController;

@Controller
public class ToPageController extends BaseController {

    @RequestMapping(value = {"", "/", "/index"})
    public ModelAndView toIndex() {
        _log.debug("【To Page: Index】");
        return new ModelAndView("index/index");
    }

    @RequestMapping("visitor")
    public ModelAndView toVisitor() {
        _log.debug("【To Page: Index】");
        return new ModelAndView("visitor/index");
    }
    /**
     * 跳转页面
     * @return
     */
    @RequestMapping("/index/{page}")
    public ModelAndView toIdexPage(@PathVariable("page") String page){
        _log.debug("【To Page: {}】",page);
        return new ModelAndView("index/"+page);
    }

    @RequestMapping(value = "/404")
    public ModelAndView to404() {
        _log.debug("【To Page: 404】");
        return new ModelAndView("error/404");
    }

    @RequestMapping(value = "/500")
    public ModelAndView to403() {
        _log.debug("【To Page: 500】");
        return new ModelAndView("error/500");
    }
}
